home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 05 - 1989 / 05.08 Aug 89 / PREC Code / Options.p < prev    next >
Encoding:
Text File  |  1989-06-14  |  19.6 KB  |  531 lines  |  [TEXT/PJMM]

  1. unit Options;
  2.  
  3. {File name: Options.p}
  4. {Function: Handle a Window}
  5. {History: 6/10/89 Original by Prototyper.   }
  6.  
  7. interface
  8.     uses
  9.         globals, FixMath, TEConvert;
  10.  
  11.     procedure preparewidth (i: integer);
  12.  
  13.     procedure prepareheight (i: integer);
  14.  
  15.     procedure SetFields;
  16.  
  17.     procedure SetDefaultPREC;
  18.  
  19.     {Initialize us so all our routines can be activated}
  20.     procedure Init_Options;
  21.  
  22.     {Record the status of all edit fields and buttons and update the list}
  23.     procedure Recordstatus;
  24.  
  25.     {Close our window}
  26.     procedure Close_Options (whichWindow: WindowPtr; var theInput: TEHandle);
  27.  
  28.     {Open our window and draw everything}
  29.     procedure Open_Options (var theInput: TEHandle);
  30.  
  31.     {Update our window, someone uncovered a part of us}
  32.     procedure Update_Options (whichWindow: WindowPtr);
  33.  
  34.     {Handle action to our window, like controls}
  35.     procedure Do_Options (myEvent: EventRecord; var theInput: TEHandle);
  36.  
  37. implementation
  38.  
  39.     const
  40.         TitleFieldid = 23;                      {Edit text ID}
  41.         WidthFieldid = 24;                      {Edit text ID}
  42.         HeightFieldid = 25;                      {Edit text ID}
  43.     var
  44.         tempRect, temp2Rect: Rect;      {Temporary rectangle}
  45.         Index: Integer;                    {For looping}
  46.         CtrlHandle: ControlHandle;        {Control handle}
  47.         sTemp, sTemp1: Str255;         {Get text entered, temp holding}
  48.         List_I_Titles: ListHandle;      {List Manager list handle}
  49.         Rect_I_Titles: Rect;            {List Manager list rectangle}
  50.         dataBounds: Rect;              {For use by lists}
  51.         cSize: Point;                  {For use by lists}
  52.         theRow: integer;               {Used for adding rows to lists}
  53.         num: extended;
  54.         fixednum: Fixed;
  55.         theCell: Cell;
  56.  
  57. {=================================}
  58.  
  59.     procedure SetTeWidth (i: integer);
  60.     begin
  61.         num := PREC4.size[i].h / 120;
  62.         fixednum := X2Fix(num);
  63.         NumToString(HiWord(Fixednum), sTemp);
  64.         num := (num - Hiword(Fixednum)) * 100;
  65.         fixednum := X2Fix(num);
  66.         NumToString(HiWord(Fixednum), sTemp1);
  67.         sTemp := concat(sTemp, '.', sTemp1);
  68.         TESetText(Pointer(Ord4(@sTemp) + 1), length(sTemp), WidthFieldhndl);{Place default text in the TE area}
  69.         SetRect(TempRect, 220, 82, 270, 102);{left,top,right,bottom of WidthField Rectangle}
  70.         TEUpdate(TempRect, WidthFieldhndl);
  71.     end;
  72.  
  73. {=================================}
  74.  
  75.     procedure SetTeHeight (i: integer);
  76.     begin
  77.         num := PREC4.size[i].v / 120;
  78.         fixednum := X2Fix(num);
  79.         NumToString(HiWord(Fixednum), sTemp);
  80.         num := (num - Hiword(Fixednum)) * 100;
  81.         fixednum := X2Fix(num);
  82.         NumToString(HiWord(Fixednum), sTemp1);
  83.         sTemp := concat(sTemp, '.', sTemp1);
  84.         TESetText(Pointer(Ord4(@sTemp) + 1), length(sTemp), HeightFieldhndl);{Place default text in the TE area}
  85.         SetRect(TempRect, 326, 82, 376, 102);{left,top,right,bottom of HeightField Rectangle}
  86.         TEUpdate(TempRect, HeightFieldhndl);
  87.     end;
  88.  
  89. {=================================}
  90.     procedure SetFields;
  91.         var
  92.             i, datalen: integer;
  93.     begin
  94.         for i := 6 downto 1 do
  95.             begin
  96.                 dataLen := length(PREC4.Title[i]);
  97.                 cSize.v := i - 1;
  98.                 LSetCell(Pointer(ord(@PREC4.Title[i]) + 1), dataLen, cSize, List_I_Titles);    {Set string in row }
  99.                 LSetSelect(false, cSize, List_I_Titles);
  100.             end;
  101.         SetTeWidth(1);
  102.         SetTeHeight(1);
  103.         TESetText(Pointer(Ord4(@PREC4.Title[1]) + 1), length(PREC4.Title[1]), TitleFieldhndl);{Place default text in the TE area}
  104.         SetRect(TempRect, 220, 40, 380, 62);    {left,top,right,bottom of TitleField Rectangle}
  105.         TEUpdate(TempRect, TitleFieldhndl);
  106.         LSetSelect(true, cSize, List_I_Titles);
  107.     end;
  108. {=================================}
  109.  
  110.     procedure SetDefaultPREC;
  111.     begin
  112.         with prec4 do
  113.             begin
  114.                 numberofbuttons := 5;
  115.                 Size[1].v := 1320;        { 11.0"        }
  116.                 Size[1].h := 1020;        { 8.50"        }
  117.                 Size[2].v := 1400;        { 11.66"        }
  118.                 Size[2].h := 990;            { 8.25"        }
  119.                 Size[3].v := 1680;        { 14.0"        }
  120.                 Size[3].h := 1020;        { 8.50"        }
  121.                 Size[4].v := 1440;        { 14.0"        }
  122.                 Size[4].h := 990;            { 8.50"        }
  123.                 Size[5].v := 1320;        { 14.0"        }
  124.                 Size[5].h := 1680;        { 8.50"        }
  125.                 Size[6].v := 0;            { undefined    }
  126.                 Size[6].h := 0;            { undefined    }
  127.                 Title[1] := 'US Letter';
  128.                 Title[2] := 'A4 Letter';
  129.                 Title[3] := 'US Legal';
  130.                 Title[4] := 'International Fanfold';
  131.                 Title[5] := 'Computer Paper';
  132.                 Title[6] := '?';
  133.             end;
  134.         setFields;
  135.         SetWTitle(MyWindow, 'Page Option Defaults');
  136.     end;
  137.  
  138. {=================================}
  139.  
  140.     {Initialize us so all our routines can be activated}
  141.     procedure Init_Options;
  142.  
  143.     begin                               {Start of Window initialize routine}
  144.         MyWindow := nil;                  {Make sure other routines know we are not valid yet}
  145.     end;                                {End of procedure}
  146.  
  147. {=================================}
  148.  
  149.     {Record the status of all edit fields and buttons and update the list}
  150.     procedure Recordstatus;
  151.         var
  152.             i, datalen: integer;
  153.             tempnumber: real;
  154.         function strtox (s: str255): extended;
  155.             var
  156.                 number: longint;
  157.                 total, multiplier: real;
  158.                 decimalposition, i: integer;
  159.         begin
  160.             total := 0;
  161.             decimalposition := pos('.', s);
  162.             multiplier := 1;
  163.             for i := (decimalposition - 1) downto 1 do
  164.                 begin
  165.                     stringtonum(s[i], number);
  166.                     total := total + (number * multiplier);
  167.                     multiplier := multiplier * 10;
  168.                 end;
  169.             multiplier := 0.1;
  170.             for i := (decimalposition + 1) to length(s) do
  171.                 begin
  172.                     stringtonum(s[i], number);
  173.                     total := total + (number * multiplier);
  174.                     multiplier := multiplier / 10;
  175.                 end;
  176.             if decimalposition = 0 then
  177.                 begin
  178.                     multiplier := 1;
  179.                     total := 0;
  180.                     for i := length(s) downto 1 do
  181.                         begin
  182.                             stringtonum(s[i], number);
  183.                             total := total + (number * multiplier);
  184.                             multiplier := multiplier * 10;
  185.                         end;
  186.                 end;
  187.             strtox := total;
  188.         end;
  189.     begin
  190.         Csize.h := 0;
  191.         TERecToStr(TitleFieldhndl, sTemp);
  192.         PREC4.Title[cSize.v + 1] := sTemp;
  193.         dataLen := length(sTemp);
  194.         LSetCell(Pointer(ord(@sTemp) + 1), dataLen, cSize, List_I_Titles);    {Set string in row }
  195.         TERecToStr(WidthFieldhndl, sTemp);
  196.         i := 120;
  197.         tempnumber := strtox(sTemp) * i;
  198.         PREC4.size[cSize.v + 1].h := trunc(tempnumber);
  199.  
  200.         TERecToStr(HeightFieldhndl, sTemp1);
  201.         tempnumber := strtox(sTemp1) * i;
  202.         PREC4.size[cSize.v + 1].v := trunc(tempnumber);
  203.  
  204.     end;
  205.  
  206. {=================================}
  207.  
  208.     {Close our window}
  209.     procedure Close_Options;
  210.  
  211.     begin                               {Start of Window close routine}
  212.         if (MyWindow <> nil) and ((MyWindow = whichWindow) or (ord4(whichWindow) = -1)) then{See if we should close this window}
  213.             begin
  214.                 if (theInput = TitleFieldhndl) then{See if this Text Edit field handle}
  215.                     theInput := nil;             {Clear the handle used}
  216.                 if (theInput = WidthFieldhndl) then{See if this Text Edit field handle}
  217.                     theInput := nil;             {Clear the handle used}
  218.                 if (theInput = HeightFieldhndl) then{See if this Text Edit field handle}
  219.                     theInput := nil;             {Clear the handle used}
  220.                 DisposeWindow(MyWindow);{Clear window and controls}
  221.                 MyWindow := nil;            {Make sure other routines know we are open}
  222.             end;                        {End for if (MyWindow<>nil)}
  223.     end;                                {End of procedure}
  224.  
  225. {=================================}
  226.  
  227.     {Update our window, someone uncovered a part of us}
  228.     procedure UpDate_Options;
  229.         var
  230.             SavePort: WindowPtr;           {Place to save the last port}
  231.             sTemp: Str255;                   {Temporary string}
  232.  
  233.     begin                               {Start of Window update routine}
  234.         Recordstatus;
  235.         if (MyWindow <> nil) and (MyWindow = whichWindow) then{Handle an open when already opened}
  236.             begin
  237.                 GetPort(SavePort);          {Save the current port}
  238.                 SetPort(MyWindow);          {Set the port to my window}
  239.                 TextFont(systemFont);       {Set the font to draw in}
  240.             {Draw a string of text,  }
  241.                 SetRect(tempRect, 273, 85, 318, 102);
  242.                 sTemp := '" X';
  243.                 TextBox(Pointer(ord(@sTemp) + 1), length(sTemp), tempRect, teJustLeft);
  244.                 TextFont(applFont);         {Set the default application font}
  245.  
  246.                 TextFont(systemFont);       {Set the font to draw in}
  247.             {Draw a string of text,  }
  248.                 SetRect(tempRect, 378, 85, 423, 102);
  249.                 sTemp := '"';
  250.                 TextBox(Pointer(ord(@sTemp) + 1), length(sTemp), tempRect, teJustLeft);
  251.                 TextFont(applFont);         {Set the default application font}
  252.  
  253.             {Update a TE box, US Letter }
  254.                 SetRect(TempRect, 220, 40, 380, 65);{left,top,right,bottom}
  255.                 FrameRect(TempRect);        {Frame this TE area}
  256.                 InsetRect(TempRect, 3, 3);{Surround the TE area}
  257.                 if (TitleFieldhndl <> nil) then{Only update if TE area is valid}
  258.                     begin                   {Update the TE area}
  259.                         TEUpdate(TempRect, TitleFieldhndl);{Update the TE area}
  260.                         TextFont(applFont);{Set the default application font}
  261.                     end;                    {End of the TE area}
  262.  
  263.             {Update a TE box, Width }
  264.                 SetRect(TempRect, 220, 82, 270, 102);{left,top,right,bottom}
  265.                 FrameRect(TempRect);        {Frame this TE area}
  266.                 InsetRect(TempRect, 3, 3);{Surround the TE area}
  267.                 if (WidthFieldhndl <> nil) then{Only update if TE area is valid}
  268.                     begin                   {Update the TE area}
  269.                         TEUpdate(TempRect, WidthFieldhndl);{Update the TE area}
  270.                         TextFont(applFont);{Set the default application font}
  271.                     end;                    {End of the TE area}
  272.  
  273.             {Update a TE box, Height }
  274.                 SetRect(TempRect, 326, 82, 376, 102);{left,top,right,bottom}
  275.                 FrameRect(TempRect);        {Frame this TE area}
  276.                 InsetRect(TempRect, 3, 3);{Surround the TE area}
  277.                 if (HeightFieldhndl <> nil) then{Only update if TE area is valid}
  278.                     begin                   {Update the TE area}
  279.                         TEUpdate(TempRect, HeightFieldhndl);{Update the TE area}
  280.                         TextFont(systemFont);{Set the default application font}
  281.                     end;                    {End of the TE area}
  282.  
  283.             {Update a List, Titles }
  284.                 SetRect(TempRect, 21, 21, 204, 117);{left,top,right,bottom}
  285.                 TempRect.Right := TempRect.Right - 15;{Go inside the scroll bar}
  286.                 InsetRect(TempRect, -1, -1);{Surround the List area}
  287.                 FrameRect(TempRect);        {Frame this List area}
  288.                 if (List_I_Titles <> nil) then{Only update if List area is valid}
  289.                     LUpdate(MyWindow^.visRgn, List_I_Titles);{Update the List area}
  290.  
  291.                 DrawControls(MyWindow);{Draw all the controls}
  292.                 SetPort(SavePort);          {Restore the old port}
  293.             end;                            {End for if (MyWindow<>nil)}
  294.     end;                                {End of procedure}
  295.  
  296. {=================================}
  297.  
  298.     {Open our window and draw everything}
  299.     procedure Open_Options;
  300.         var
  301.             Index: Integer;                {For looping}
  302.             dataBounds: Rect;              {For making lists}
  303.             cSize: Point;                  {For making lists}
  304.  
  305.  
  306.  
  307. {This is a routine used to add strings to an existing list}
  308.         procedure Add_List_String (theString: Str255; theList: ListHandle);
  309.             var
  310.                 theRow: integer;                 {The Row that we are adding}
  311.  
  312.         begin
  313.             if (theList <> nil) then
  314.                 begin
  315.                     cSize.h := 0;               {Point to the correct column}
  316.                     theRow := LAddRow(1, 200, theList);{Add another row at the end of the list}
  317.                     cSize.v := theRow;          {Point to the row just added}
  318.                     sTemp := theString;          {Get the string to add}
  319.                     LSetCell(Pointer(ord(@sTemp) + 1), length(sTemp), cSize, theList);{Place string in row just created}
  320.                     LDraw(cSize, theList);      {Draw the new string}
  321.                 end;
  322.         end;
  323.  
  324.  
  325.     begin                               {Start of Window open routine}
  326.  
  327.         if (MyWindow = nil) then        {Handle an open when already opened}
  328.             begin
  329.                 MyWindow := GetNewWindow(1, nil, Pointer(-1));{Get the window from the resource file}
  330.                 SetPort(MyWindow);          {Prepare to write into our window}
  331.  
  332.             {Open a TE box, Width }
  333.                 SetRect(TempRect, 220, 82, 270, 102);{left,top,right,bottom}
  334.                 FrameRect(TempRect);        {Frame this TE area}
  335.                 InsetRect(TempRect, 3, 3);{Restore the original size}
  336.                 WidthFieldhndl := TENew(TempRect, TempRect);{Create the TE area}
  337.                 if (theInput <> nil) then{See if there is already a TE area}
  338.                     TEDeactivate(theInput);{Yes, so turn it off}
  339.                 theInput := WidthFieldhndl;        {Activate the TE area}
  340.                 HLock(Handle(WidthFieldhndl));{Lock the handle before using it}
  341.                 WidthFieldhndl^^.txFont := systemFont;{Font to use for the TE area}
  342.                 WidthFieldhndl^^.fontAscent := 12;{Font ascent}
  343.                 WidthFieldhndl^^.lineHeight := 12 + 3 + 1;{Font ascent + descent + leading}
  344.                 HUnLock(Handle(WidthFieldhndl));{UnLock the handle when done}
  345.                 sTemp := '8.50';
  346.                 TESetText(Pointer(Ord4(@sTemp) + 1), length(sTemp), WidthFieldhndl);{Place default text in the TE area}
  347.                 TEActivate(WidthFieldhndl);        {Make the TE area active}
  348.                 TEUpdate(TempRect, WidthFieldhndl);
  349.                 TextFont(applFont);         {Set the default application font}
  350.  
  351.             {Open a TE box, Height }
  352.                 SetRect(TempRect, 326, 82, 376, 102);{left,top,right,bottom}
  353.                 FrameRect(TempRect);        {Frame this TE area}
  354.                 InsetRect(TempRect, 3, 3);{Restore the original size}
  355.                 HeightFieldhndl := TENew(TempRect, TempRect);{Create the TE area}
  356.                 if (theInput <> nil) then{See if there is already a TE area}
  357.                     TEDeactivate(theInput);{Yes, so turn it off}
  358.                 theInput := HeightFieldhndl;        {Activate the TE area}
  359.                 HLock(Handle(HeightFieldhndl));{Lock the handle before using it}
  360.                 HeightFieldhndl^^.txFont := systemFont;{Font to use for the TE area}
  361.                 HeightFieldhndl^^.fontAscent := 12;{Font ascent}
  362.                 HeightFieldhndl^^.lineHeight := 12 + 3 + 1;{Font ascent + descent + leading}
  363.                 HUnLock(Handle(HeightFieldhndl));{UnLock the handle when done}
  364.                 sTemp := '11.0';
  365.                 TESetText(Pointer(Ord4(@sTemp) + 1), length(sTemp), HeightFieldhndl);{Place default text in the TE area}
  366.                 TEActivate(HeightFieldhndl);        {Make the TE area active}
  367.                 TEUpdate(TempRect, HeightFieldhndl);
  368.                 TextFont(applFont);         {Set the default application font}
  369.  
  370.             {Open a TE box, Title }
  371.                 SetRect(TempRect, 220, 40, 380, 62);{left,top,right,bottom}
  372.                 FrameRect(TempRect);        {Frame this TE area}
  373.                 InsetRect(TempRect, 3, 3);{Restore the original size}
  374.                 TitleFieldhndl := TENew(TempRect, TempRect);{Create the TE area}
  375.                 if (theInput <> nil) then{See if there is already a TE area}
  376.                     TEDeactivate(theInput);{Yes, so turn it off}
  377.                 theInput := TitleFieldhndl;        {Activate the TE area}
  378.                 HLock(Handle(TitleFieldhndl));{Lock the handle before using it}
  379.                 TitleFieldhndl^^.txFont := systemFont;{Font to use for the TE area}
  380.                 TitleFieldhndl^^.fontAscent := 12;{Font ascent}
  381.                 TitleFieldhndl^^.lineHeight := 12 + 3 + 1;{Font ascent + descent + leading}
  382.                 HUnLock(Handle(TitleFieldhndl));{UnLock the handle when done}
  383.                 sTemp := 'US Letter';
  384.                 TESetText(Pointer(Ord4(@sTemp) + 1), length(sTemp), TitleFieldhndl);{Place default text in the TE area}
  385.                 TEActivate(TitleFieldhndl);        {Make the TE area active}
  386.                 TEUpdate(TempRect, TitleFieldhndl);
  387.                 TextFont(applFont);         {Set the default application font}
  388.  
  389.         {Make a List, Titles }
  390.                 SetRect(TempRect, 21, 21, 204, 117);{left,top,right,bottom}
  391.                 Rect_I_Titles := tempRect;{Save the list position}
  392.                 TempRect.Right := TempRect.Right - 15;{Go inside the scroll bar area}
  393.                 InsetRect(TempRect, -1, -1);{Surround the List area}
  394.                 FrameRect(TempRect);        {Frame this List area}
  395.                 InsetRect(TempRect, 1, 1);{Restore to the List area}
  396.                 SetRect(dataBounds, 0, 0, 1, 0);{Make the empty list}
  397.                 cSize.h := TempRect.Right - TempRect.Left;{Get the width of the list}
  398.                 cSize.v := 16;               {Set the HEIGHT of each list element}
  399.                 List_I_Titles := LNew(TempRect, dataBounds, cSize, 0, MyWindow, TRUE, FALSE, FALSE, TRUE);{Create the list}
  400.                 List_I_Titles^^.selFlags := lOnlyOne + lNoNilHilite;{Set for only one active item at a time}
  401.                 LdoDraw(TRUE, List_I_Titles);{Draw this list structure}
  402.                 cSize.h := 0;               {Point to the correct column, starts at zero}
  403.                 Add_List_String('US Letter', List_I_Titles);{Add in the new string}
  404.                 Add_List_String('A4 Letter', List_I_Titles);{Add in the new string}
  405.                 Add_List_String('US Legal', List_I_Titles);{Add in the new string}
  406.                 Add_List_String('International Fanfold', List_I_Titles);{Add in the new string}
  407.                 Add_List_String('Computer Paper', List_I_Titles);{Add in the new string}
  408.                 Add_List_String('?', List_I_Titles);{Add in the new string}
  409.                 cSize.h := 0;                {All elements are in column 0}
  410.                 cSize.v := 0;                {Select the first list element}
  411.                 LSetSelect(TRUE, cSize, List_I_Titles);
  412.  
  413.                 ShowWindow(MyWindow);       {Show the window now}
  414.                 SelectWindow(MyWindow);{Bring our window to the front}
  415.                 SetDefaultPrec;
  416.             end                         {End for if (MyWindow<>nil)}
  417.         else
  418.             SelectWindow(MyWindow);{Already open, so show it}
  419.  
  420.     end;                                {End of procedure}
  421.  
  422. {=================================}
  423.  
  424.     {Handle action to our window, like controls}
  425.     procedure Do_Options;
  426.  
  427.         var
  428.             RefCon: longint;                 {RefCon for controls}
  429.             code: integer;                   {Location of event in window or controls}
  430.             theValue: integer;               {Current value of a control}
  431.             whichWindow: WindowPtr;      {Window pointer where event happened}
  432.             myPt: Point;                     {Point where event happened}
  433.             theControl: ControlHandle;       {Handle for a control}
  434.             MyErr: OSErr;                    {OS error returned}
  435.             DoubleClick: boolean;              {Used by lists}
  436.             datalen: integer;
  437.  
  438.     begin                               {Start of Window handler}
  439.         Recordstatus;
  440.         if (MyWindow <> nil) then       {Handle only when the window is valid}
  441.             begin
  442.                 code := FindWindow(myEvent.where, whichWindow);{Get where in window and which window}
  443.  
  444.                 if (myEvent.what = MouseDown) and (MyWindow = whichWindow) then{}
  445.                     begin                   {}
  446.                         myPt := myEvent.where;{Get mouse position}
  447.                         with MyWindow^.portBits.bounds do{Make it relative}
  448.                             begin
  449.                                 myPt.h := myPt.h + left;
  450.                                 myPt.v := myPt.v + top;
  451.                             end;
  452.  
  453.  
  454.                         SetRect(tempRect, 220, 40, 380, 62);{Position of the TE}
  455.                         if PtInRect(myPt, tempRect) then{Check for pressed in the TE  US Letter }
  456.                             begin
  457.                                 if (theInput <> nil) then{See if there is already a TE area}
  458.                                     TEDeactivate(theInput);{Yes, so turn it off}
  459.                                 theInput := TitleFieldhndl;
  460.                                 TEActivate(theInput);{Turn it on}
  461.                                 TEClick(myPt, FALSE, TitleFieldhndl);
  462.                             end;
  463.  
  464.  
  465.                         SetRect(tempRect, 220, 82, 270, 102);{Position of the TE}
  466.                         if PtInRect(myPt, tempRect) then{Check for pressed in the TE  Width }
  467.                             begin
  468.                                 if (theInput <> nil) then{See if there is already a TE area}
  469.                                     TEDeactivate(theInput);{Yes, so turn it off}
  470.                                 theInput := WidthFieldhndl;
  471.                                 TEActivate(theInput);{Turn it on}
  472.                                 TEClick(myPt, FALSE, WidthFieldhndl);
  473.                             end;
  474.  
  475.  
  476.                         SetRect(tempRect, 326, 82, 376, 102);{Position of the TE}
  477.                         if PtInRect(myPt, tempRect) then{Check for pressed in the TE  Height }
  478.                             begin
  479.                                 if (theInput <> nil) then{See if there is already a TE area}
  480.                                     TEDeactivate(theInput);{Yes, so turn it off}
  481.                                 theInput := HeightFieldhndl;
  482.                                 TEActivate(theInput);{Turn it on}
  483.                                 TEClick(myPt, FALSE, HeightFieldhndl);
  484.                             end;
  485.  
  486.                         if PtInRect(myPt, Rect_I_Titles) then
  487.                             begin
  488.                                 DoubleClick := LClick(myPt, myEvent.modifiers, List_I_Titles);
  489.                                 if DoubleClick then
  490.                                     begin
  491.                                     end;
  492.                                 begin
  493.                                     cSize := LLastClick(List_I_Titles);
  494.                                     datalen := 100;
  495.                                     LGetCell(Pointer(ord(@sTemp) + 1), dataLen, cSize, List_I_Titles);{Get string in row }
  496.                                     if not (LGetSelect(false, cSize, List_I_Titles)) then
  497.                                         begin
  498.                                             theCell.v := 0;
  499.                                             theCell.h := 0;
  500.                                             if LGetSelect(true, theCell, List_I_Titles) then
  501.                                                 begin
  502.                                                     cSize := theCell;
  503.                                                     datalen := 100;
  504.                                                     LGetCell(Pointer(ord(@sTemp) + 1), dataLen, cSize, List_I_Titles);    {Get string in row }
  505.                                                 end;
  506.                                         end;
  507.                                     TESetText(Pointer(Ord4(@PREC4.Title[cSize.v + 1]) + 1), dataLen, TitleFieldhndl);    {Place text in the TE area}
  508.                                     SetRect(TempRect, 220, 40, 380, 62);    {left,top,right,bottom of TitleField Rectangle}
  509.                                     TEUpdate(TempRect, TitleFieldhndl);
  510.                                     SetTeWidth(cSize.v + 1);
  511.                                     SetTeHeight(cSize.v + 1);
  512.                                 end;
  513.                             end;
  514.  
  515.                     end;
  516.  
  517.                 if (MyWindow = whichWindow) and (code = inContent) then{for our window}
  518.                     begin
  519.  
  520.                         code := FindControl(myPt, whichWindow, theControl);{Get type of control}
  521.  
  522.                         if (code <> 0) then{Check type of control}
  523.                             code := TrackControl(theControl, myPt, nil);{Track the control}
  524.  
  525.                     end;                    {End for if (MyWindow=whichWindow)}
  526.             end;                        {End for if (MyWindow<>nil)}
  527.     end;                                {End of procedure}
  528.  
  529. {=================================}
  530.  
  531. end.                                    {End of unit}